
<?php
	$auth = Zend_Auth::getInstance();
	if ($auth->hasIdentity())	
		$u = $auth->getIdentity();
?>

<?
    $uri = $_SERVER['REQUEST_URI']; 
    $requestUri = substr($uri,4);
?>
<a href="/vi/<?= $requestUri?>"> <img src="/public/themes/gome/images/vi.gif.jpeg" alt="Vietnamese" /></a>
&nbsp;&nbsp;&nbsp; 
<a href="/en/<?= $requestUri?>"> <img src="/public/themes/gome/images/en.gif.jpeg" alt="English" /></a>
&nbsp;&nbsp;&nbsp;
    <img src="/public/themes/gome/GOME/IMAGE/ICON/Icon28X23.gif" width="28px" height="23px" />
    <a href="http://webmail.eurovinama.com/" target="_blank">Mail</a> &nbsp;&nbsp;&nbsp;

<?if (isset($u)) :?>
     <img src="/public/themes/gome/GOME/IMAGE/ICON/Icon20X23.gif" width="20px" height="23px" />
     <a href="<?=$this->hvnUrl(array('action' => 'logout'),'account') . "?backurl=". $_SERVER['REQUEST_URI']?>"> Logout &nbsp;&nbsp;</a> 
<?else: ?>
    <img src="/public/themes/gome/GOME/IMAGE/ICON/Icon20X23.gif" width="20px" height="23px" />
    <a href="#loginForm" class="loginDOMWindow" >Login &nbsp;&nbsp;</a>
<?endif?>


<?if (!isset($u)) :?>

                <div id="loginForm" style="display: none;color: gray;padding-left:100px">
                        <div><h1>User Login</h1></div> 
                        <form id="loginFormAjax" accept-charset="UTF-8" action="<?=$this->hvnUrl(array('action' => 'login'),'account')?>" method="POST">
                           User Name:<br/><input type="text" value="" id="name" name="name"/>
                           <br/>
                           Password: <br/><input type="password" value="" id="pass" name="pass"/><br/>
                                <div id="id_1" align="center" style="color:red"></div>
                                <br/>
                           <input type="submit" value="Login" name="submit" id="submitForm" /> 
                        </form>
                </div> 



<script src="/public/library/jquery/thickbox/jquery.DOMWindow.js" type="text/javascript"></script>
<script src="/public/library/jquery/jquery.form.js" type="text/javascript"></script>



<script type="text/javascript">

$(function() {
       
        $('.loginDOMWindow').openDOMWindow({ 
                        height:200, 
                        width:300, 
                        positionType:'centered', 
                        positionTop:100, 
                        eventType:'click', 
                        positionLeft:100, 
                        windowSourceID:'#loginForm', 
                        windowPadding:20, 
                        /*draggable:1,*/ 
                        windowBGColor:'#FFFFFF', 
                        borderColor:'#5D5DF4', 
                        overlayOpacity:15 
                });
                
                
                $("#loginFormAjax").ajaxForm({
                        dataType: 'json',
                        success: function(json)
                        {
                            if (! json.success)
                            {
                                //$("#loginForm div.loginErrorMessage").html(json.errorMessage);
                                alert(json.errorMessage);
                            }
                            else
                            {
				                var p = /^\/(en|vi|jp|cn|fr|kr)\/logout$/;
				                if (p.test(window.location.pathname))
				                {
				                	//redirect to home
				                	window.location.href = "/";
				                }
				                else
	                                window.location.reload();
                            }        
                                //$('.loginDOMWindow').closeDOMWindow({eventType:'click'}); 
                        }
                });
                
    });
</script>
<?endif ?>
